<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>简易计算器</title>
</head>
<body>
    <h1>简易计算器</h1>
    <input type="text" name="num1" id="num1">
    <select name="" id="operator">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" name="num2" id="num2">
    <input type="button" value="计算">
    <span><input type = "text" id = "result"></span>
</body>
<script src="/webjars/jquery/3.7.1/jquery.min.js"></script>
<script>
    $(":button").click(function() {
         $.ajax({
        url:"/calc/js",
        type:"post",
        data:{
            num1:$("#num1").val(),
            num2:$("#num2").val(),
            operator:$("#operator").val(),
        },
        success:function(result){
            $("#result").val(result)
        }
    })
    })
   
</script>
</html>